/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


package AccessLayer;


import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import webservice.AuctionProdukt;
import webservice.Produkt;
import webservice.User;
/**
 *
 * @author benji
 */
 public abstract class AccessLayer {

    public AccessLayer(){
    }
    
    public static Properties giveConfig(){
        Properties currentProperties = null;
        try {

            // Properties anlegen
            currentProperties = new Properties();
            InputStream in = null;
            // File suchen
            try {
                // File öffnen
                in = new FileInputStream("WiSiConf.properties");
            } catch (FileNotFoundException ex) {
                Logger.getLogger(AccessLayer.class.getName()).log(Level.SEVERE, null, ex);
            }
            // Properties laden
            currentProperties.load(in);
            in.close();

        } catch (IOException ex) {
            Logger.getLogger(AccessLayer.class.getName()).log(Level.SEVERE, null, ex);
        }
        finally{
            return currentProperties;
        }

    }

    public int bid(int auctionId, int userId, int amount) {
        int i= 0;
        return i;
    }

    public void changePassword(String password, int userId) {
    }

    public void changeUsername(String name, int userId) {
    }

    public String checkUser(String user){
        String cmdReturn = null;
        return cmdReturn;
    }

    public String checkPassword(String user, String password){
        String DBpassword = null;
        return DBpassword;
    }

    public void deleteItem(Produkt p) {
    }

    public void deleteUser(User u) {
    }

    public int getGuthaben(int userId) {
        int guthaben = 0;
        return guthaben;
    }

    public int getProduktStatistik(int iD) {
        int i=0;
        return i;
    }

    public Produkt[] getProdukte() {
        Produkt[] result = null;
        return result;
    }

    public Produkt[] getProdukteByUserId(int userId) {
        Produkt[] result = null;
        return result;
    }


    public AuctionProdukt[] getAuctionItemList() {
        AuctionProdukt[] result = null;
        return result;
    }

    public String getRank(int userId) {
        String rank = null;
        return rank;
    }

    public int getRankCount() {
        int countRank = 0;
        return countRank;
    }

    public String getRegisterDate(int userId) {
        String regDate = null;
        return regDate;
    }

    public int getUmsatzProTag(int userId) {
        int umsatz = 0;
        return umsatz;
    }

    public int getUserId(String user, String password) {
        int id = 0;
        return id;
    }

    public User[] getUserList() {
        User[] result = null;
        return result;
    }

    public String getUserName(int userId) {
        String userName = null;
        return userName;
    }

    public boolean isAdmin(int userId) {
        boolean isAdmin = false;
        return isAdmin;
    }

    public void newUser(String username, String password) {
    }

    public int produce(Produkt p, int amount, int userId) {
        int i = 0;
        return i;
    }

    public void refresh() {
    }

    public void saveItem(Produkt p) {
    }

    public Produkt[] searchItemPrice(int preis) {
        Produkt[] list = null;
        return list;
    }

    public Produkt[] searchItemName(String name) {
        Produkt[] list = null;
        return list;
    }

    public Produkt[] searchItemPriceAndName(String name, int preis) {
        Produkt[] list = null;
        return list;
    }

    public int startAuction(Produkt p, int amount, int userId, int dauer) {
        int i = 0;
        return i;
    }

    public int startAuctionAsAdmin(Produkt p, int amount, int userId, int dauer) {
        int i = 0;
        return i;
    }

    public void updateItem(Produkt p) {
    }

    public void updateUser(User u) {
    }

    /*******************************
     *      ALT
     * -----------------------
     *      NEU
     *******************************/

    public synchronized String getPasswordHash(int userId){
        String hash = null;
        return hash;
    }

    public void writeSaveGameIntoDatabase(User createWebserviceUser, Produkt[] produkte) {
    }

}
